export default{
    //vuex存放数据
    state: {
        //导航栏是否收缩
        isCollapse:false,
        menu:[],
        currentMenu:null,
        //定义tablist方便数据传递，默认会有一个首页,
        tabsList:[
            {
                path:'/',
                name:'home',
                label:"首页",
                icon:"platform-eleme"
            },
        ]
    },
    mutations: {
        //实现面包栏联动效果
        selectMenu(state,val){
            if(val.name !=='home'){
                state.currentMenu = val
                //标签栏，去重操作
                let result =state.tabsList.findIndex(item =>item.name ===val.name)
                result===-1 ?  state.tabsList.push(val) :''
            }else{
                state.currentMenu = null
            }
        },
        //关闭标签的方法
        closeTab(state,val){
            let result = state.tabsList.findIndex(item =>item.name===val.name)
            state.tabsList.splice(result,1)
        },
        //导航栏是否收缩
        collapseMenu(state){
            state.isCollapse =!state.isCollapse
        }
    },
    actions: {
    },
    modules: {
    }
}